#ifndef BOOK_H
#define BOOK_H
#include <sstream>
#include <iostream>
#include <vector>

class Member;

class Book
{
	public: 
		Book(std::string author_, std::string title_, std::string publisher_, int year_, int edition_, std::string ISBN_, int borrowableAmount_);
		~Book(){}
		void AddBorrower(Member *member) {borrowedBy.push_back(member);}
		void RemoveBorrower(Member *member); 
		void IncBorrowableAmount(int amount) {borrowableAmount += amount;}
		bool IsBorrowable() const {return borrowableAmount>0;}
		std::string GetID() const {return id;}
		std::string GetAuthor() const {return author;}
		std::string GetTitle() const {return title;}
		std::string GetPublisher() const {return publisher;}
		int GetYear() const {return year;}
		int GetEdition() const {return edition;}
		std::string GetISBN() const {return ISBN;}
		int GetBorrowableAmount() const {return borrowableAmount;}
		std::vector<Member*> GetBorrowedBy() const {return borrowedBy;}

		friend std::ostream& operator<<(std::ostream& os, Book *book)
		{
			os << "ID: " << book->id << "\n" 
			<< "Author: " << book->author << "\n"
			<< "Title: " << book->title << "\n"
			<< "Publisher: " << book->publisher << "\n"
			<< "Year: " << book->year << "\n"
			<< "Edition: " << book->edition << "\n"
			<< "ISBN: " << book->ISBN << "\n"
			<< "Borrowable amount: " << book->borrowableAmount << "\n";
			return os;
		}
	
	private:
		std::string id;
		std::string author;
		std::string title;
		std::string publisher;
		int year;
		int edition;
		std::string ISBN;
		int borrowableAmount;
		std::vector<Member*> borrowedBy;
};

#endif